class EmptyLineToOne:
    def __init__(self):
        pass

    def remove_extra_empty_lines(self, text: str) -> str:
        """将连续多个空行转换为单个空行"""
        if not text:
            return ""

        lines = text.splitlines()
        cleaned_lines = []
        previous_empty = False

        for line in lines:
            is_empty = not line.strip()  # 检查是否为空行

            if is_empty:
                if not previous_empty:  # 如果是第一个空行，保留
                    cleaned_lines.append('')
                    previous_empty = True
                # 如果是连续的空行，跳过
            else:
                cleaned_lines.append(line)
                previous_empty = False

        return '\n'.join(cleaned_lines)